package com.cnap.model.schedule.engine.alg;

import cn.hutool.core.util.IdUtil;
import com.cnap.db.entity.DeployClusterPO;
import com.cnap.model.intelligent.IntelligentClusterInfo;
import com.cnap.model.schedule.engine.EngineClusterInfo;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.List;

/**
 * <类说明>
 *
 * @author xc
 **/
public class AlgDeployClusterInfo {
    // 名称
    private String name;
    // 服务商
    private String providerName;
    // ip
    private String ip;
    // 内部ip
    private String innerIp;
    // resourceType
    private String resourceType;
    // accountName 云商账户
    private String accountName;
    // CPU GPU
    private String calculateType;
    // public private
    private String commerceType;
    // createVmInfos
    private List<CreateVmInfo> createVmInfos;
    // clusterDetails
    private List<ClusterDetail> clusterDetails;
    // code
    private int code;
    // msg
    private String msg;

    /**
     * get
     *
     * @return CalculateType
     */
    public String getCalculateType() {
        return calculateType;
    }

    /**
     * set
     *
     * @param calculateType calculateType
     */
    public void setCalculateType(String calculateType) {
        this.calculateType = calculateType;
    }

    /**
     * get
     *
     * @return CommerceType
     */
    public String getCommerceType() {
        return commerceType;
    }

    /**
     * set
     *
     * @param commerceType commerceType
     */
    public void setCommerceType(String commerceType) {
        this.commerceType = commerceType;
    }

    /**
     * get
     *
     * @return AccountName
     */
    public String getAccountName() {
        return accountName;
    }

    /**
     * set
     *
     * @param accountName accountName
     */
    public void setAccountName(String accountName) {
        this.accountName = accountName;
    }

    /**
     * get
     *
     * @return Name
     */
    public String getName() {
        return name;
    }

    /**
     * set
     *
     * @param name name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * get
     *
     * @return ProviderName
     */
    public String getProviderName() {
        return providerName;
    }

    /**
     * set
     *
     * @param providerName providerName
     */
    public void setProviderName(String providerName) {
        this.providerName = providerName;
    }

    /**
     * get
     *
     * @return Ip
     */
    public String getIp() {
        return ip;
    }

    /**
     * set
     *
     * @param ip ip
     */
    public void setIp(String ip) {
        this.ip = ip;
    }

    /**
     * get
     *
     * @return InnerIp
     */
    public String getInnerIp() {
        return innerIp;
    }

    /**
     * set
     *
     * @param innerIp innerIp
     */
    public void setInnerIp(String innerIp) {
        this.innerIp = innerIp;
    }

    /**
     * get
     *
     * @return ResourceType
     */
    public String getResourceType() {
        return resourceType;
    }

    /**
     * set
     *
     * @param resourceType resourceType
     */
    public void setResourceType(String resourceType) {
        this.resourceType = resourceType;
    }

    /**
     * get
     *
     * @return CreateVmInfos
     */
    public List<CreateVmInfo> getCreateVmInfos() {
        return createVmInfos;
    }

    /**
     * set
     *
     * @param createVmInfos createVmInfos
     */
    public void setCreateVmInfos(List<CreateVmInfo> createVmInfos) {
        this.createVmInfos = createVmInfos;
    }

    /**
     * get
     *
     * @return ClusterDetails
     */
    public List<ClusterDetail> getClusterDetails() {
        return clusterDetails;
    }

    /**
     * set
     *
     * @param clusterDetails clusterDetails
     */
    public void setClusterDetails(List<ClusterDetail> clusterDetails) {
        this.clusterDetails = clusterDetails;
    }

    /**
     * get
     *
     * @return Code
     */
    public int getCode() {
        return code;
    }

    /**
     * set
     *
     * @param code code
     */
    public void setCode(int code) {
        this.code = code;
    }

    /**
     * get
     *
     * @return Msg
     */
    public String getMsg() {
        return msg;
    }

    /**
     * set
     *
     * @param msg msg
     */
    public void setMsg(String msg) {
        this.msg = msg;
    }

    /**
     * 获取engineClusterInfo
     *
     * @return 结果
     */
    public EngineClusterInfo toEngineClusterInfo() {
        EngineClusterInfo engineClusterInfo = new EngineClusterInfo();
        engineClusterInfo.setName(name);
        engineClusterInfo.setIp(ip);
        engineClusterInfo.setProviderName(providerName);
        engineClusterInfo.setInnerIp(innerIp);
        return engineClusterInfo;
    }

    /**
     * 转换成deployClusterPO
     *
     * @return 结果
     */
    public DeployClusterPO toDeployClusterPo() {
        DeployClusterPO po = new DeployClusterPO();
        po.setId(IdUtil.simpleUUID());
        po.setClusterName(this.name);
        po.setIp(this.ip);
        po.setProviderName(this.providerName);
        po.setInnerIp(this.innerIp);
        po.setCreateTime(LocalDateTime.now(ZoneId.of("Asia/Shanghai")));

        po.setAccountName(this.accountName);

        return po;
    }

    /**
     * 转换成IntelligentClusterInfo
     *
     * @return 结果
     */
    public IntelligentClusterInfo toIntelligentClusterInfo() {
        IntelligentClusterInfo clusterInfo = new IntelligentClusterInfo();
        clusterInfo.setClusterName(this.name);
        clusterInfo.setProvider(this.providerName);
        return clusterInfo;
    }
}
